/**
 * 主导航
 */



															// 头--------------对应的内容--------整个，头+内容---------第几个-----内容中的第一个a-----------上一个的所有---------上一个的内容第一个a
_EsdDynamicTransformationScript.navTabChange = function (focusObjSelector, listObjSelector, mouseEventObjSelector, keyDownNum, listElementsSelector, prevMouseEventObjSelector, prevListObjsSelector) {
    var keydownName = "keydown.navKeydown_" + keyDownNum;
    var keydownName2 = keydownName + "_1";
    $(focusObjSelector).focus(function () {
		if ($(listObjSelector).is(":hidden")) {
			$(mouseEventObjSelector).mouseover();
		}
        $(this).bind(keydownName, function (e) {
            if (e.shiftKey && e.keyCode == 9) {
                if (prevMouseEventObjSelector != "") {
					$(focusObjSelector).mouseout();
					$(prevMouseEventObjSelector+" .ws_xlk").mouseover();
					$(prevListObjsSelector).last().focus();
					$(this).unbind(keydownName);  // 失去焦点时解绑有问题在这解绑一次
					return false;
                } else{
					$(focusObjSelector).mouseout();
					$(this).unbind(keydownName);  // 失去焦点时解绑有问题在这解绑一次
				}
            } else if (e.keyCode == 9) {
				
            }
        });

    });
    $(focusObjSelector).blur(function () {
        $(this).unbind(keydownName);
    });
	
    $(listElementsSelector).last().focus(function () {
        $(this).bind(keydownName2, function (e) {
            if (e.shiftKey && e.keyCode == 9) {
            } else if (e.keyCode == 9) {
                $(mouseEventObjSelector).mouseout();
            }
        });
    });
    $(listElementsSelector).last().blur(function () {
        $(this).unbind(keydownName2);
    });
};


_EsdDynamicTransformationScript.navArray = new Array();

// 导航第一个栏目
_EsdDynamicTransformationScript.nav1 = {}
_EsdDynamicTransformationScript.nav1.focusObjSelector = "#nav .clearfix li.nLi:eq(1) .ws_s1 a"; // 按tab聚焦元素的选择器
_EsdDynamicTransformationScript.nav1.listObjSelector = "#nav .clearfix li.nLi:eq(1) .ws_xlk"; // 按tab聚焦后展示列表选择器
																								// 用来判断列表是否已经展示
_EsdDynamicTransformationScript.nav1.mouseEventObjSelector = "#nav .clearfix li.nLi:eq(1)"; // 按tab聚焦后展示的列表所使用的鼠标事件绑定的元素
_EsdDynamicTransformationScript.nav1.keyDownNum = 1; // keydown事件标识 最好不要重复
_EsdDynamicTransformationScript.nav1.listElementsSelector = "#nav .clearfix li.nLi:eq(1) .ws_xlk a"; // 按tab聚焦后
																										// 展示列表中a链接的选择器(展示列表中第一个a标签)
_EsdDynamicTransformationScript.nav1.prevMouseEventObjSelector = ""; // 上一个相邻的鼠标事件(mouseover)的元素
																		// 如果是向上切换没有就使用空字符串""
_EsdDynamicTransformationScript.nav1.prevListObjsSelector = ""; // 上一个相邻的展示列表中a链接的选择器

_EsdDynamicTransformationScript.navArray.push(_EsdDynamicTransformationScript.nav1);  // 放到数组里循环

// 导航第二个栏目
_EsdDynamicTransformationScript.nav2 = {}
_EsdDynamicTransformationScript.nav2.focusObjSelector = "#nav .clearfix li.nLi:eq(2) .ws_s1 a"; // 按tab聚焦元素的选择器
_EsdDynamicTransformationScript.nav2.listObjSelector = "#nav .clearfix li.nLi:eq(2) .ws_xlk"; // 按tab聚焦后展示列表选择器
																								// 用来判断列表是否已经展示
_EsdDynamicTransformationScript.nav2.mouseEventObjSelector = "#nav .clearfix li.nLi:eq(2)"; // 按tab聚焦后展示的列表所使用的鼠标事件绑定的元素
_EsdDynamicTransformationScript.nav2.keyDownNum = 2; // keydown事件标识 最好不要重复
_EsdDynamicTransformationScript.nav2.listElementsSelector = "#nav .clearfix li.nLi:eq(2) .ws_xlk a"; // 按tab聚焦后
																										// 展示列表中a链接的选择器
_EsdDynamicTransformationScript.nav2.prevMouseEventObjSelector = "#nav .clearfix li.nLi:eq(1)"; // 上一个相邻的鼠标事件(mouseover)的元素
																								// 如果是向上切换没有就使用空字符串""
_EsdDynamicTransformationScript.nav2.prevListObjsSelector = "#nav .clearfix li.nLi:eq(1) .ws_xlk a"; // 上一个相邻的展示列表中a链接的选择器

_EsdDynamicTransformationScript.navArray.push(_EsdDynamicTransformationScript.nav2);  // 放到数组里循环


// 导航第三个栏目
_EsdDynamicTransformationScript.nav3 = {}
_EsdDynamicTransformationScript.nav3.focusObjSelector = "#nav .clearfix li.nLi:eq(3) .ws_s1 a";


for(var i=0; i<_EsdDynamicTransformationScript.navArray.length; i++){
	_EsdDynamicTransformationScript.navTabChange(_EsdDynamicTransformationScript.navArray[i].focusObjSelector, _EsdDynamicTransformationScript.navArray[i].listObjSelector, 
		_EsdDynamicTransformationScript.navArray[i].mouseEventObjSelector, _EsdDynamicTransformationScript.navArray[i].keyDownNum, _EsdDynamicTransformationScript.navArray[i].listElementsSelector,
		_EsdDynamicTransformationScript.navArray[i].prevMouseEventObjSelector, _EsdDynamicTransformationScript.navArray[i].prevListObjsSelector);
}


_EsdDynamicTransformationScript.navArrayy = new Array();

// 导航第四个栏目
_EsdDynamicTransformationScript.nav4 = {}
_EsdDynamicTransformationScript.nav4.focusObjSelector = "#nav .clearfix li.nLi:eq(4) .ws_s1 a"; // 按tab聚焦元素的选择器
_EsdDynamicTransformationScript.nav4.listObjSelector = "#nav .clearfix li.nLi:eq(4) .ws_xlk"; // 按tab聚焦后展示列表选择器
																								// 用来判断列表是否已经展示
_EsdDynamicTransformationScript.nav4.mouseEventObjSelector = "#nav .clearfix li.nLi:eq(4)"; // 按tab聚焦后展示的列表所使用的鼠标事件绑定的元素
_EsdDynamicTransformationScript.nav4.keyDownNum = 4; // keydown事件标识 最好不要重复
_EsdDynamicTransformationScript.nav4.listElementsSelector = "#nav .clearfix li.nLi:eq(4) .ws_xlk a"; // 按tab聚焦后
																										// 展示列表中a链接的选择器(展示列表中第一个a标签)
_EsdDynamicTransformationScript.nav4.prevMouseEventObjSelector = ""; // 上一个相邻的鼠标事件(mouseover)的元素
																		// 如果是向上切换没有就使用空字符串""
_EsdDynamicTransformationScript.nav4.prevListObjsSelector = ""; // 上一个相邻的展示列表中a链接的选择器

_EsdDynamicTransformationScript.navArrayy.push(_EsdDynamicTransformationScript.nav4);  // 放到数组里循环

// 导航第五个栏目
_EsdDynamicTransformationScript.nav5 = {}
_EsdDynamicTransformationScript.nav5.focusObjSelector = "#nav .clearfix li.nLi:eq(5) .ws_s1 a"; // 按tab聚焦元素的选择器
_EsdDynamicTransformationScript.nav5.listObjSelector = "#nav .clearfix li.nLi:eq(5) .ws_xlk"; // 按tab聚焦后展示列表选择器
																								// 用来判断列表是否已经展示
_EsdDynamicTransformationScript.nav5.mouseEventObjSelector = "#nav .clearfix li.nLi:eq(5)"; // 按tab聚焦后展示的列表所使用的鼠标事件绑定的元素
_EsdDynamicTransformationScript.nav5.keyDownNum = 5; // keydown事件标识 最好不要重复
_EsdDynamicTransformationScript.nav5.listElementsSelector = "#nav .clearfix li.nLi:eq(5) .ws_xlk a"; // 按tab聚焦后
																										// 展示列表中a链接的选择器
_EsdDynamicTransformationScript.nav5.prevMouseEventObjSelector = "#nav .clearfix li.nLi:eq(4)"; // 上一个相邻的鼠标事件(mouseover)的元素
																								// 如果是向上切换没有就使用空字符串""
_EsdDynamicTransformationScript.nav5.prevListObjsSelector = "#nav .clearfix li.nLi:eq(4) .ws_xlk a"; // 上一个相邻的展示列表中a链接的选择器

_EsdDynamicTransformationScript.navArrayy.push(_EsdDynamicTransformationScript.nav5);  // 放到数组里循环

// 导航第六个栏目
_EsdDynamicTransformationScript.nav6 = {}
_EsdDynamicTransformationScript.nav6.focusObjSelector = "#nav .clearfix li.nLi:eq(6) .ws_s1 a"; // 按tab聚焦元素的选择器
_EsdDynamicTransformationScript.nav6.listObjSelector = "#nav .clearfix li.nLi:eq(6) .ws_xlk"; // 按tab聚焦后展示列表选择器
																								// 用来判断列表是否已经展示
_EsdDynamicTransformationScript.nav6.mouseEventObjSelector = "#nav .clearfix li.nLi:eq(6)"; // 按tab聚焦后展示的列表所使用的鼠标事件绑定的元素
_EsdDynamicTransformationScript.nav6.keyDownNum = 6; // keydown事件标识 最好不要重复
_EsdDynamicTransformationScript.nav6.listElementsSelector = "#nav .clearfix li.nLi:eq(6) .ws_xlk a"; // 按tab聚焦后
																										// 展示列表中a链接的选择器
_EsdDynamicTransformationScript.nav6.prevMouseEventObjSelector = "#nav .clearfix li.nLi:eq(5)"; // 上一个相邻的鼠标事件(mouseover)的元素
																								// 如果是向上切换没有就使用空字符串""
_EsdDynamicTransformationScript.nav6.prevListObjsSelector = "#nav .clearfix li.nLi:eq(5) .ws_xlk a"; // 上一个相邻的展示列表中a链接的选择器

_EsdDynamicTransformationScript.navArrayy.push(_EsdDynamicTransformationScript.nav6);  // 放到数组里循环



for(var i=0; i<_EsdDynamicTransformationScript.navArrayy.length; i++){
	_EsdDynamicTransformationScript.navTabChange(_EsdDynamicTransformationScript.navArrayy[i].focusObjSelector, _EsdDynamicTransformationScript.navArrayy[i].listObjSelector, 
		_EsdDynamicTransformationScript.navArrayy[i].mouseEventObjSelector, _EsdDynamicTransformationScript.navArrayy[i].keyDownNum, _EsdDynamicTransformationScript.navArrayy[i].listElementsSelector,
		_EsdDynamicTransformationScript.navArrayy[i].prevMouseEventObjSelector, _EsdDynamicTransformationScript.navArrayy[i].prevListObjsSelector);
}


// 导航第三个的倒叙设置
$(_EsdDynamicTransformationScript.nav3.focusObjSelector).focus(function(){
	$(this).bind("keydown.navKeydown_3", function (e) {
		if(e.shiftKey&&e.keyCode==9){
			$(_EsdDynamicTransformationScript.nav2.focusObjSelector).mouseover();
			$(_EsdDynamicTransformationScript.nav2.listElementsSelector).last().focus();
			return false;
		}
	});
});

$(_EsdDynamicTransformationScript.nav3.focusObjSelector).blur(function(){
	$(this).unbind("keydown.navKeydown_3");
});
 




// 二层

// 各个选项名称对应的内容数量
 _EsdDynamicTransformationScript.num1 = $(".ws_slideTxtBox .bd ul:eq(0) a").length-1;
 _EsdDynamicTransformationScript.num2 = $(".ws_slideTxtBox .bd ul:eq(2) a").length-1;

// 各个选项名称
 _EsdDynamicTransformationScript.esdTagNum1 = $(".ws_slideTxtBox .hd ul li:eq(0) a");
 _EsdDynamicTransformationScript.esdTagNum2 = $(".ws_slideTxtBox .hd ul li:eq(1) a");

// 各个选项中的第一个内容
 _EsdDynamicTransformationScript.esdTagNum1Content1 = $(".ws_slideTxtBox .bd ul:eq(0) a:eq(0)");
 _EsdDynamicTransformationScript.esdTagNum2Content1 = $(".ws_slideTxtBox .bd ul:eq(2) a:eq(0)");

// 各个选项中的最后一个内容
 _EsdDynamicTransformationScript.esdTagNum1ContentN = $(".ws_slideTxtBox .bd ul:eq(0) a:eq("+_EsdDynamicTransformationScript.num1+")");
 _EsdDynamicTransformationScript.esdTagNum2ContentN = $(".ws_slideTxtBox .bd ul:eq(2) a:eq("+_EsdDynamicTransformationScript.num2+")");

// 第一块
_EsdDynamicTransformationScript.esdTagNum1.focus(function (e) {
	
	e = $(this).mouseover();
	$(this).bind("keydown.keydown_1", function (e) {
		if(e.shiftKey&&e.keyCode==9){
			
		}else if (e.keyCode == 9) {
			_EsdDynamicTransformationScript.esdTagNum1Content1.focus();
			return false;
		}
	});

});
_EsdDynamicTransformationScript.esdTagNum1.blur(function () {
	
	$(this).unbind("keydown.keydown_1");
});

_EsdDynamicTransformationScript.esdTagNum1Content1.focus(function () {
	$(this).bind("keydown.keydown_s1", function (e) {
		if (e.shiftKey && e.keyCode == 9) {
			_EsdDynamicTransformationScript.esdTagNum1.focus();
			return false;
		}
	});
});
_EsdDynamicTransformationScript.esdTagNum1Content1.blur(function () {
	$(this).unbind("keydown.keydown_s1");
});

_EsdDynamicTransformationScript.esdTagNum1ContentN.focus(function () {
	$(this).bind("keydown.keydown_e1", function (e) {
		if(e.shiftKey&&e.keyCode==9){
			
		}else if (e.keyCode == 9) {
			_EsdDynamicTransformationScript.esdTagNum2.focus();
			return false;
		}
	});
});
_EsdDynamicTransformationScript.esdTagNum1ContentN.blur(function () {
	$(this).unbind("keydown.keydown_e1");
});

// 第二块
_EsdDynamicTransformationScript.esdTagNum2.focus(function (e) {
	e = $(this).mouseover();
	$(this).bind("keydown.keydown_2", function (e) {
		if(e.shiftKey&&e.keyCode==9){
			_EsdDynamicTransformationScript.esdTagNum1.mouseover();
			_EsdDynamicTransformationScript.esdTagNum1ContentN.focus();
			return false;
		}else if (e.keyCode == 9) {
			_EsdDynamicTransformationScript.esdTagNum2Content1.focus();
			return false;
		}
	});
});
_EsdDynamicTransformationScript.esdTagNum2.blur(function () {
	$(this).unbind("keydown.keydown_2");
});



//导航，上一个的最后一个导入下一个的第一个
//第一个导第二个
$(_EsdDynamicTransformationScript.nav1.listElementsSelector).last().focus(function (e) {
	e = $(this).mouseover();
	$(this).bind("keydown.keydownnl_1", function (e) {
		if(e.shiftKey&&e.keyCode==9){

		}else if (e.keyCode == 9) {
			$(_EsdDynamicTransformationScript.nav2.focusObjSelector).focus();
			return false;
		}
	});
});
$(_EsdDynamicTransformationScript.nav1.listElementsSelector).last().blur(function () {
	$(this).unbind("keydown.keydownnl_1");
});

//第二个导第三个
$(_EsdDynamicTransformationScript.nav2.listElementsSelector).last().focus(function (e) {
	e = $(this).mouseover();
	$(this).bind("keydown.keydownnl_2", function (e) {
		if(e.shiftKey&&e.keyCode==9){

		}else if (e.keyCode == 9) {
			$(_EsdDynamicTransformationScript.nav3.focusObjSelector).focus();
			return false;
		}
	});
});
$(_EsdDynamicTransformationScript.nav2.listElementsSelector).last().blur(function () {
	$(this).unbind("keydown.keydownnl_2");
});

//第四个导第五个
$(_EsdDynamicTransformationScript.nav4.listElementsSelector).last().focus(function (e) {
	e = $(this).mouseover();
	$(this).bind("keydown.keydownnl_4", function (e) {
		if(e.shiftKey&&e.keyCode==9){

		}else if (e.keyCode == 9) {
			$(_EsdDynamicTransformationScript.nav5.focusObjSelector).focus();
			return false;
		}
	});
});
$(_EsdDynamicTransformationScript.nav4.listElementsSelector).last().blur(function () {
	$(this).unbind("keydown.keydownnl_4");
});

//第五个导第六个
$(_EsdDynamicTransformationScript.nav5.listElementsSelector).last().focus(function (e) {
	e = $(this).mouseover();
	$(this).bind("keydown.keydownnl_5", function (e) {
		if(e.shiftKey&&e.keyCode==9){

		}else if (e.keyCode == 9) {
			$(_EsdDynamicTransformationScript.nav6.focusObjSelector).focus();
			return false;
		}
	});
});
$(_EsdDynamicTransformationScript.nav5.listElementsSelector).last().blur(function () {
	$(this).unbind("keydown.keydownnl_5");
});

//第六个导轮播/面包屑导航
$(_EsdDynamicTransformationScript.nav6.listElementsSelector).last().focus(function (e) {
	e = $(this).mouseover();
	$(this).bind("keydown.keydownnl_6", function (e) {
		if(e.shiftKey&&e.keyCode==9){

		}else if (e.keyCode == 9) {
			
			if( $(".main a:eq(0)").length != 0 ){
				$(".main a:eq(0)").focus();
				$(_EsdDynamicTransformationScript.nav6.mouseEventObjSelector).mouseout();
				return false;
			}
			
		}
	});
});
$(_EsdDynamicTransformationScript.nav6.listElementsSelector).last().blur(function () {
	$(this).unbind("keydown.keydownnl_6");
});







